/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
 * Fade Slider Toggle plugin
 * 
 * Copyright(c) 2009, Cedric Dugas
 * http://www.position-relative.net
 *	
 * A sliderToggle() with opacity
 * Licenced under the MIT Licence
 */

var $jq = jQuery.noConflict();

$jq.fn.fadeSliderToggle = function(settings) {
 	 settings = jQuery.extend({
		speed:500,
		easing : "swing"
	}, settings)
	
	$jq(this).animate({
		opacity: 'toggle',
		height: 'toggle'
	}, settings.speed, settings.easing);
}; 

//plugin arranged by azurenote


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var ism_Last;

var imagelist =	[
	[
		"http://pds17.egloos.com/pmf/201004/11/34/c0095034_4bc1b085280bb.gif",
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b07f9b89e.gif",
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b0820cd75.gif",
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b08359024.gif",
		"http://pds17.egloos.com/pmf/201004/11/34/c0095034_4bc1b07ce69f6.gif",
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b07816cf8.gif",
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b07e63aa8.gif"
	],
	[
		"http://pds17.egloos.com/pmf/201004/11/34/c0095034_4bc1b089ed00e.jpg",
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b08e75af4.jpg",
		"http://pds17.egloos.com/pmf/201004/11/34/c0095034_4bc1b08e4bf27.jpg",
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b0931b9e5.jpg",
		"http://pds17.egloos.com/pmf/201004/11/34/c0095034_4bc1b0930b607.jpg",
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b0979aba1.jpg",
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b0877ba88.jpg"
	],
	[
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b113e066e.gif",
		"http://pds17.egloos.com/pmf/201004/11/34/c0095034_4bc1b1163bbc3.gif",
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b11aa71f0.gif",
		"http://pds17.egloos.com/pmf/201004/11/34/c0095034_4bc1b11dba790.gif",
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b121df1bb.gif",
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b126a4a44.gif",
		"http://pds17.egloos.com/pmf/201004/11/34/c0095034_4bc1b128ac0e7.gif"
	],
	[
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b09e61f1b.png",
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b09e83dea.png",
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b0a0716c6.png",
		"http://pds17.egloos.com/pmf/201004/11/34/c0095034_4bc1b0a7db1c1.png",
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b0ac278e2.png",
		"http://pds17.egloos.com/pmf/201004/11/34/c0095034_4bc1b0b13ea49.png",
		"http://pds16.egloos.com/pmf/201004/11/34/c0095034_4bc1b0ba52ca4.png"
	]
];

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$jq(
function()
{
	var imageset = imagelist[Math.floor(Math.random()*(imagelist.length))];
	//setup toggle
	$jq('.ismMenuImageHeader')
		.each(function(index,item) {
				$jq(this).attr("src", imageset[index]);
			})
		.click(function(event) {
				if (this == event.target)
				{
					if (ism_Last)
					{
						$jq(ism_Last).next().fadeSliderToggle();

						if (ism_Last == this)
						{
							ism_Last = null;
							return false;
						}
					}

					$jq(this).next().fadeSliderToggle();
					ism_Last = this;
				}
				return false;
			})

		.next().hide();
}
);